home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / eiffel / smalleif.97 / se.t / SmallEiffel / lib_test / try_animal.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.2 KB  |  63 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TRY_ANIMAL
  5.    
  6. creation {ANY}
  7.    make
  8.    
  9. feature {ANY}
  10.    
  11.    x: ANIMAL;
  12.    
  13.    make is
  14.       local 
  15.      dog: DOG;
  16.      cat: CAT;
  17.      mille_pattes: MILLE_PATTES;
  18.      animal: ANIMAL;
  19.       do
  20.      !!dog;
  21.      !!cat;
  22.      un("cat",cat);
  23.      animal := clone(cat);
  24.      un("cat",animal);
  25.      animal := clone(dog);
  26.      un("dog",animal);
  27.      animal := clone(mille_pattes);
  28.      un("rien du tout",animal);
  29.      
  30.      !MILLE_PATTES!animal;
  31.      animal := clone(animal);
  32.      un("mille pattes",animal);
  33.      
  34.      if dog.is_equal(dog) then
  35.         std_output.put_string("Good :-)%N");
  36.      else
  37.         std_output.put_string("Bad :-(%N");
  38.      end;
  39.      if animal.is_equal(animal) then
  40.         std_output.put_string("Good :-)%N");
  41.      else
  42.         Current.std_output.put_string("Bad :-(%N");
  43.      end;
  44.      if equal(animal,animal) then
  45.         std_output.put_string("Good :-)%N");
  46.      else
  47.         Current.std_output.put_string("Bad :-(%N");
  48.      end;
  49.       end;
  50.    
  51.    un(quoi: STRING; a: ANIMAL) is
  52.       do
  53.      std_output.put_string("Voici un ");
  54.      std_output.put_string(quoi);
  55.      std_output.put_string(" : ");
  56.      if a /= Void then
  57.         a.cry;
  58.      end;
  59.      std_output.put_new_line;
  60.       end;
  61.    
  62. end -- class TRY_ANIMAL
  63.